var touxiang=document.getElementById("touxiang");
function setCookie(cname,cvalue,exdays){
    var d = new Date();
    d.setTime(d.getTime()+(exdays*24*60*60*1000));
    var expires = "expires="+d.toGMTString();
    document.cookie = cname+"="+cvalue+"; "+expires;
}
function getCookie(cname){
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i=0; i<ca.length; i++) {
        var c = ca[i].trim();
        if (c.indexOf(name)==0) { return c.substring(name.length,c.length); }
    }
    return "";
}

function login() {
    
user = document.getElementById("user").value;
password = document.getElementById("password").value;


check_user = getCookie("user"+user);
check_password = getCookie("password"+user);
if (check_user == user) {
    if (check_password == password) {
        alert("登录成功");
        touxiang.style.display="block"
    } else {
        alert("密码错误");
    }
} else {
    alert("账号错误");
}

}


function r() {
    
    user = document.getElementById("user").value;
    password = document.getElementById("password").value;
    setCookie("user"+user,user,1);
    setCookie("password"+user,password,1);
    alert("注册成功");


    }

    var WEM=document.getElementById("EWM");
    var EWM2=document.getElementById("EWM2");
    EWM.onmouseover=function(){
        EWM2.style.display="block";
        EWM.style.display="none";
    }
    EWM.onmouseout=function(){
        EWM.style.display="block";
        EWM2.style.display="none";
    }
    var xiazai=document.getElementById("xiazai");
    var EWM3=document.getElementById("EWM3");
    xiazai.onmouseover=function(){
        EWM3.style.display="block";
        xiazai.style.color="#34a6db";
    }
    xiazai.onmouseout=function(){
        EWM3.style.display="none";
        xiazai.style.color="";
    }

    var weibo=document.getElementById("weibo");
    var EWM4=document.getElementById("EWM4");
    weibo.onmouseover=function(){
        EWM4.style.display="block";
        weibo.style.color="#34a6db";
    }
    weibo.onmouseout=function(){
        EWM4.style.display="none";
        weibo.style.color="";
    }

    var weixin=document.getElementById("weixin");
    var EWM5=document.getElementById("EWM5");
    weixin.onmouseover=function(){
        EWM5.style.display="block";
    }
    weixin.onmouseout=function(){
        EWM5.style.display="none";
    }

    var gongyi=document.getElementById("gongyi");
    gongyi.onmouseover=function(){
        gongyi.style.color="#34a6db";
    }
    gongyi.onmouseout=function(){
        gongyi.style.color="";
    }
